<?php
declare (strict_types = 1);

namespace app\admin\middleware;

use think\facade\Session;

class Check
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        $userinfo = Session::get("userinfo");
        if(is_null($userinfo)){
            return redirect('/admin/index/login');
        }
        $request->userinfo = $userinfo;
        return $next($request);
    }
}
